package com.zzyl.nursing.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zzyl.common.utils.StringUtils;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.mapper.NursingProjectMapper;
import com.zzyl.nursing.service.MemberOrdersProjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author YH
 */
@Service
public class MemberOrdersProjectServiceImpl extends ServiceImpl<NursingProjectMapper, NursingProject> implements MemberOrdersProjectService {

    /**
     * 分页查询护理项目
     * @param page
     * @param name
     * @param status
     * @return
     */
    @Override
    public Page<NursingProject> page(Page<NursingProject> page, String name, Integer status) {
        //构建查询控制器
        LambdaQueryWrapper<NursingProject> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.like(StringUtils.isNotBlank(name), NursingProject::getName, name)
                .eq(status != null, NursingProject::getStatus, status)
                .orderByAsc(NursingProject::getOrderNo);
        //执行查询
        return baseMapper.selectPage(page, queryWrapper);

    }
}
